<?php

namespace  App\Http\Controllers\V1;

use App\Helpers\Logger\SLogger;
use App\Helpers\RestResponseFactory;
use App\Helpers\RestUtils;
use App\Http\Controllers\Controller;
use App\Models\Factory\CoinFactory;
use App\Models\Factory\SmsFactory;
use App\Models\Factory\UserFactory;
use App\Models\Orm\Banner;
use App\Models\Orm\CoinDrawLog;
use App\Models\Orm\CoinMarket;
use App\Models\Orm\CoinStoreLog;
use App\Models\Orm\Query;
use App\Models\Orm\UserCoinLog;
use App\Services\Core\Sms\Dahan\DahanService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

/**
 * Class GeetesController
 * @package App\Http\Controllers\V1
 * 短信
 */
class QueryController extends  Controller
{

    /**
     * 发送短信
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function query(Request $request)
    {

        $querys = Query::orderBy('index','asc')->get()->toArray();

        if(!empty($querys)){
            foreach ($querys as $k => $query ){
                $datas = explode(',', $query['pay']);
                $querys[$k]['weixin']  = 0;
                $querys[$k]['zhifubao']  = 0;
                $querys[$k]['bank']  = 0;
                foreach ( $datas as $da){
                    if($da == 1){
                        $querys[$k]['weixin']  = 1;
                    }elseif($da == 2){
                        $querys[$k]['zhifubao']  = 1;

                    }else{
                        $querys[$k]['bank']  = 1;
                    }
                }

            }

        }
            $data['query'] = $querys;
        return RestResponseFactory::ok($data, 200);

    }

}